package com.px.plan.domain;

import com.px.common.annotation.Excel;
import com.px.common.core.domain.BaseEntity;
import com.px.common.config.MinIoClientConfig;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;

/**
 * 行动记录媒体信息对象 plan_action_record_media
 *
 * @author WRJ
 * @date 2024-08
 */
public class PlanActionRecordMedia extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /**  */
    @ApiModelProperty(value = "")
    private Long id;

    /** 行动记录ID */
    @ApiModelProperty(value = "行动记录ID")
    @Excel(name = "行动记录ID")
    private Long recordId;

    /** 无人机SN */
    @ApiModelProperty(value = "无人机SN")
    @Excel(name = "无人机SN")
    private String droneSn;

    /** 媒体类型.1=图片,2=视频 */
    @ApiModelProperty(value = "媒体类型.1=图片,2=视频")
    @Excel(name = "媒体类型.1=图片,2=视频")
    private Integer mediaType;

    /** 媒体地址 */
    @ApiModelProperty(value = "媒体地址")
    @Excel(name = "媒体地址")
    private String mediaUrl;

    /** 媒体地址 */
    @ApiModelProperty(value = "媒体预览地址")
    @Excel(name = "媒体预览地址")
    private String mediaPreviewUrl;

    /** 创建人所属部门ID */
    @ApiModelProperty(value = "创建人所属部门ID")
    @Excel(name = "创建人所属部门ID")
    private Long deptId;

    /** 经度 */
    @ApiModelProperty(value = "经度")
    @Excel(name = "经度")
    private BigDecimal longitude;

    /** 纬度 */
    @ApiModelProperty(value = "纬度")
    @Excel(name = "纬度")
    private BigDecimal latitude;

    /** 高度 */
    @ApiModelProperty(value = "高度")
    @Excel(name = "高度")
    private BigDecimal height;

    /** 高度 */
    @ApiModelProperty(value = "行动ID")
    @Excel(name = "行动ID")
    private Long actionId;

    /** 文件大小 */
    @ApiModelProperty(value = "文件大小")
    @Excel(name = "文件大小")
    private Long mediaSize=0L;

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setRecordId(Long recordId)
    {
        this.recordId = recordId;
    }

    public Long getRecordId()
    {
        return recordId;
    }
    public void setDroneSn(String droneSn)
    {
        this.droneSn = droneSn;
    }

    public String getDroneSn()
    {
        return droneSn;
    }
    public void setMediaType(Integer mediaType)
    {
        this.mediaType = mediaType;
    }

    public Integer getMediaType()
    {
        return mediaType;
    }
    public void setMediaUrl(String mediaUrl)
    {
        this.mediaUrl = mediaUrl;
    }

    public String getMediaUrl()
    {
        return mediaUrl;
    }
    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    public Long getDeptId()
    {
        return deptId;
    }
    public void setLongitude(BigDecimal longitude)
    {
        this.longitude = longitude;
    }

    public BigDecimal getLongitude()
    {
        return longitude;
    }
    public void setLatitude(BigDecimal latitude)
    {
        this.latitude = latitude;
    }

    public BigDecimal getLatitude()
    {
        return latitude;
    }
    public void setHeight(BigDecimal height)
    {
        this.height = height;
    }

    public BigDecimal getHeight()
    {
        return height;
    }

    public Long getActionId() {
        return actionId;
    }

    public void setActionId(Long actionId) {
        this.actionId = actionId;
    }

    public Long getMediaSize() {
        return mediaSize;
    }

    public void setMediaSize(Long mediaSize) {
        this.mediaSize = mediaSize;
    }

    public String getMediaPreviewUrl() {
        if (null != mediaUrl && mediaUrl.startsWith("http")) {
            return mediaUrl;
        } else {
            // todo改成读取配置文件的
            return MinIoClientConfig.PREVIEW_END_POINT_URL + "/" + mediaUrl;
        }
    }

    public void setMediaPreviewUrl(String mediaPreviewUrl) {
        this.mediaPreviewUrl = mediaPreviewUrl;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("recordId", getRecordId())
                .append("droneSn", getDroneSn())
                .append("mediaType", getMediaType())
                .append("mediaUrl", getMediaUrl())
                .append("deptId", getDeptId())
                .append("createTime", getCreateTime())
                .append("createBy", getCreateBy())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("remark", getRemark())
                .append("delFlag", getDelFlag())
                .append("longitude", getLongitude())
                .append("latitude", getLatitude())
                .append("height", getHeight())
                .append("mediaSize", getMediaSize())
                .toString();
    }
}
